/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mysqlviewer.database;

import java.sql.Connection;
import java.sql.DriverManager;
import mysqlviewer.gui.DialogPesan;

/**
 *
 * @author agoesh
 */
public class Koneksi {
    String hostName, userName, pass; 
    
    public Koneksi(String hostName, String userName, String pass){
        super();
        this.hostName=hostName;
        this.userName=userName;
        this.pass=pass;
    }
    
    public Connection bukaKoneksi(){
        try{
            Class.forName("org.gjt.mm.mysql.Driver");
            Connection koneksi=DriverManager.getConnection("jdbc:mysql://"+hostName, userName, pass);
            return koneksi;
        }catch(Exception e){
            new DialogPesan(null, true, e.getMessage());
            return null;
        }
    }
}
